package com.example.demo.repository;

import com.example.demo.entity.Resource_apply;
import io.lettuce.core.dynamic.annotation.Param;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface Resource_applyRepository extends JpaRepository<Resource_apply,Integer> {
    @Query(value = "select * from resource_apply where Resource_id = :resourceid AND State = 1;",nativeQuery = true)
    List<Resource_apply> findAllByResourceIdandState(@Param("resourceid") Integer resourceid);

    @Query(value = "select * from resource_apply where applyer_id = :userid ;",nativeQuery = true)
    List<Resource_apply> findAllByApplyerId(@Param("userid") Integer userid);
}
